<template>
  <div class="commend wrap">
    <ul>
      <li
        v-for="item in data"
        :key="item.id"
        @click="$router.push(`/detail?id=${item.id}`)"
      >
        <div class="content">
          <!-- 图片 -->
          <div class="img">
            <span></span>
            <img :src="imgBaseUrl + item.coverImg" alt="" />
          </div>
          <!-- 文字 -->
          <div class="txt">
            <p>{{ item.name }}</p>
            <span
              >{{ item.coin }}<img src="@/assets/img/monad.png" alt=""
            /></span>
            <button>立即兑换</button>
          </div>
        </div>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  props: ["title", "data"],

  mounted() {},
};
</script>

<style lang="less" scoped>
.commend {
  height: auto;
}
ul {
  width: 1200px;
  display: flex;
  justify-content: space-start;
  flex-wrap: wrap;
  align-content: space-between;

  li {
    width: 285px;
    height: 492px;
    margin-right: 20px;
    margin-bottom: 30px;
    &:nth-child(4n) {
      margin-right: 0;
    }
    .img {
      img {
        width: 285px;
        height: 330px;
      }
    }
    .content {
      background: #ffffff;
      transition: 0.5s;
    }
    .txt {
      text-align: center;
      width: 285px;
      height: 162px;
      background: #ffffff;
      display: flex;
      flex-direction: column;
      justify-content: space-evenly;

      p {
        height: 18px;
        font-size: 18px;
        font-family: SourceHanSansSC;
        font-weight: 300;
        color: #333333;
        line-height: 23px;
      }
      span {
        height: 30px;
        font-size: 18px;
        font-family: SourceHanSansSC;
        font-weight: bold;
        color: #ff5e0f;
        line-height: 23px;
        img {
          width: 20px;
          height: 20px;
          vertical-align: baseline;
          margin-left: 10px;
        }
      }
      button {
        width: 100px;
        height: 36px;
        border: 1px solid #0a328e;
        background-color: #fff;
        margin: 0 auto;
        color: #0a328e;
      }
    }
    &:hover .content {
      margin-top: -20px;
      transition: 0.5s;
      box-shadow: 0 0 20px #ccc;
    }
    &:hover button {
      background-color: #0a328e;
      color: #fff;
    }
  }
}
</style>